package com.czl.module_service.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.czl.base.binding.command.BindingCommand
import com.czl.base.binding.command.BindingConsumer
import com.czl.base.data.bean.tengyun.AssetHandleSortBean
import com.czl.module_service.R
import com.czl.module_service.databinding.ItemAssetHandleProductInuseBinding

class AssetHandleProductInuseAdapter :
    BaseQuickAdapter<AssetHandleSortBean, BaseDataBindingHolder<ItemAssetHandleProductInuseBinding>>(
        R.layout.item_asset_handle_facility_inuse
    ) {

    override fun convert(
        holder: BaseDataBindingHolder<ItemAssetHandleProductInuseBinding>,
        item: AssetHandleSortBean,
    ) {
        holder.dataBinding?.run {
            data = item
            adapter = this@AssetHandleProductInuseAdapter
            executePendingBindings()
        }
    }

    val onItemClick: BindingCommand<Any> = BindingCommand(BindingConsumer {
        if (it is AssetHandleSortBean) {

//            val intent = Intent(context, PurchaseApplyInfoFragment::class.java)
//            intent.putExtra("handleApplicationId", it.handleApplicationId)
//            context?.startActivity(intent)
//
//            setOnItemClickListener() { adapter, _, position ->
//                val bean: HealthReportBean.Data = adapter.data[position] as HealthReportBean.Data
//                val intent = Intent(context, HealthReportDetailActivity::class.java)
//                intent.putExtra("data", bean.healthyId)
//                context?.startActivity(intent)
//            }
//
//            fragment.startContainerActivity(
//                AppConstants.Router.Service.F_SERVICE_PURCHASE_APPLY_INFO
//            )
        }
    })
}
